package com.getword.service;

import com.getword.domain.User;
import com.getword.domain.Video;
import com.getword.web.model.Result;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

public interface VideoService {
    /**
     * 上传字幕文件，将字幕文件保存到static/upload/video下，
     * 同时将文件名暂存在session中
     */
    Result uploadCaption(MultipartFile file, HttpServletRequest request);
    Result uploadCover(MultipartFile file, HttpServletRequest request);

    /**
     * 保存视频信息
     */
    Result saveVideo(Video video, Long outlineId, String detailNum);

    /**
     * 视频查询，分页
     */
    @Cacheable("demo")
    Result getVideos(Pageable page, Long gradeId, Long courseId);

    Page<Video> getVideoPage(Pageable page, Long gradeId, Long courseId, String title, User user);

    /**
     * 根据视频ID查询
     */
    Result getVideoById(String id);

    Result addSentiment(Video video);

    Result zan(String videoId);

    /**
     * 获取用户点赞状态
     * @param videoId
     * @return
     */
    Result getZanState(String videoId);

    /**
     * 获取视频点赞个数
     * @param videoId
     * @return
     */
    Result getZanCount(String videoId);
}
